return;
}
# Article exists. Check for edit conflict.
+ # Don't check for conflict when appending a comment - this should always work
$this->clear(); # Force reload of dates, etc.
- if ( $this->getTimestamp() != $wpEdittime ) { $isConflict = true; }
+ if ( $section!="new" && ( $this->getTimestamp() != $wpEdittime ) ) { $isConflict = true; }
$u = $wgUser->getID();
# Supress edit conflict with self
global $wgUser,$wgArticle,$wgTitle,$wpPreview;
$nh=$wgUser->getOption( "numberheadings" );
$st=$wgUser->getOption( "showtoc" );
- $es=$wgUser->getID() && $wgUser->getOption( "editsection" );
- $esr=$wgUser->getID() && $wgUser->getOption( "editsectiononrightclick" );
-
+ if(!$wgTitle->userCanEdit()) {
+ $es=0;
+ $esr=0;
+ } else {
+ $es=$wgUser->getID() && $wgUser->getOption( "editsection" );
+ $esr=$wgUser->getID() && $wgUser->getOption( "editsectiononrightclick" );
+ }
# if the string __NOTOC__ (not case-sensitive) occurs in the HTML, do not
# add TOC
if($st && preg_match("/__NOTOC__/i",$text)) {
foreach($blocks as $block) {
- if(($es || $esr) && !isset($wpPreview) && $c>0 && $i==0) {
+ if(($es) && !isset($wpPreview) && $c>0 && $i==0) {
# This is the [edit] link that appears for the top block of text when
# section editing is enabled
$full.=$sk->editSectionLink(0);
function pageTitle()
{
- global $wgOut, $wgTitle;
+ global $wgOut, $wgTitle, $wgUser;
$s = "<h1 class='pagetitle'>" . $wgOut->getPageTitle() . "</h1>";
+ if($wgUser->getOption("editsectiononrightclick") && $wgTitle->userCanEdit()) { $s=$this->editSectionScript(0,$s);}
return $s;
}
if ( $wgOut->isArticle() ) {
$s .= "<strong>" . $this->editThisPage() . "</strong>";
if ( 0 != $wgUser->getID() ) {
- $s .= $sep . $this->watchThisPage() .
- $sep . $this->moveThisPage();
+ $s .= $sep . $this->watchThisPage();
}
$s .= $sep . $this->talkLink()
. $sep . $this->historyLink()
}
if ( $wgUser->isSysop() && $wgTitle->getArticleId() ) {
$s .= "\n<br>" . $this->deleteThisPage() .
- $sep . $this->protectThisPage();
+ $sep . $this->protectThisPage() .
+ $sep . $this->moveThisPage();
}
$s .= "<br>\n" . $this->otherLanguages();
}
$toc."</td></tr></table><P>\n";
}
+ # These two do not check for permissions: check $wgTitle->userCanEdit before calling them
function editSectionScript($section,$head) {
global $wgTitle,$wgUser,$oldid;
- if($wgTitle->isProtected() && !$wgUser->isSysop()) return $head;
if($oldid) return $head;
$url = wfLocalUrlE($wgTitle->getPrefixedText(),"action=edit§ion=$section");
return "<span onContextMenu='document.location=\"".$url."\";return false;'>{$head}</span>";
function editSectionLink($section) {
global $wgTitle,$wgUser,$oldid;
- if($wgTitle->isProtected() && !$wgUser->isSysop()) return "";
if($oldid) return "";
$editurl="§ion={$section}";
$url=$this->makeKnownLink($wgTitle->getPrefixedText(),wfMsg("editsection"),"action=edit".$editurl);